0caf0cffaba609ae8248120db93604b3becc29c3,compiler/backend/src/org/jetbrains/jet/codegen/state/JetTypeMapper.java,JetTypeMapper,writeAdditionalConstructorParameters,#ConstructorDescriptor#BothSignatureWriter#,742
Before Change
if (captureThis != null) {
sw.writeParameterType(JvmMethodParameterKind.OUTER);
mapType(captureThis.getDefaultType(), sw, JetTypeMapperMode.VALUE);
sw.writeParameterTypeEnd();
}
JetType captureReceiverType = closure != null ? closure.getCaptureReceiverType() : null;
if (captureReceiverType != null) {
sw.writeParameterType(JvmMethodParameterKind.RECEIVER);
mapType(captureReceiverType, sw, JetTypeMapperMode.VALUE);
sw.writeParameterTypeEnd();
}
ClassDescriptor containingDeclaration = descriptor.getContainingDeclaration();
if (containingDeclaration.getKind() == ClassKind.ENUM_CLASS || containingDeclaration.getKind() == ClassKind.ENUM_ENTRY) {
sw.writeParameterType(JvmMethodParameterKind.ENUM_NAME);
mapType(KotlinBuiltIns.getInstance().getStringType(), sw, JetTypeMapperMode.VALUE);
sw.writeParameterTypeEnd();
sw.writeParameterType(JvmMethodParameterKind.ENUM_ORDINAL);
mapType(KotlinBuiltIns.getInstance().getIntType(), sw, JetTypeMapperMode.VALUE);
sw.writeParameterTypeEnd();
}
if (closure == null) return;
for (DeclarationDescriptor variableDescriptor : closure.getCaptureVariables().keySet()) {
Type type;
if (variableDescriptor instanceof VariableDescriptor && !(variableDescriptor instanceof PropertyDescriptor)) {
Type sharedVarType = getSharedVarType(variableDescriptor);
if (sharedVarType == null) {
sharedVarType = mapType(((VariableDescriptor) variableDescriptor).getType());
}
type = sharedVarType;
}
else if (isLocalNamedFun(variableDescriptor)) {
type = asmTypeForAnonymousClass(bindingContext, (FunctionDescriptor) variableDescriptor);
}
else {
type = null;
}
if (type != null) {
sw.writeParameterType(JvmMethodParameterKind.CAPTURED_LOCAL_VARIABLE);
sw.writeAsmType(type);
sw.writeParameterTypeEnd();
}
}
ResolvedCall<ConstructorDescriptor> superCall = closure.getSuperCall();
if (superCall != null && isAnonymousObject(descriptor.getContainingDeclaration())) {
for (JvmMethodParameterSignature parameter : mapSignature(superCall.getResultingDescriptor()).getValueParameters()) {
sw.writeParameterType(JvmMethodParameterKind.SUPER_OF_ANONYMOUS_CALL_PARAM);
sw.writeAsmType(parameter.getAsmType());
sw.writeParameterTypeEnd();
}
}
}
After Change
sw.writeParameterTypeEnd();
}
private void writeAdditionalConstructorParameters(@NotNull ConstructorDescriptor descriptor, @NotNull BothSignatureWriter sw) {
CalculatedClosure closure = bindingContext.get(CodegenBinding.CLOSURE, descriptor.getContainingDeclaration());
ClassDescriptor captureThis = getExpectedThisObjectForConstructorCall(descriptor, closure);
if (captureThis != null) {
writeParameter(sw, JvmMethodParameterKind.OUTER, captureThis.getDefaultType());
}
JetType captureReceiverType = closure != null ? closure.getCaptureReceiverType() : null;
if (captureReceiverType != null) {
writeParameter(sw, JvmMethodParameterKind.RECEIVER, captureReceiverType);
}
ClassDescriptor containingDeclaration = descriptor.getContainingDeclaration();
if (containingDeclaration.getKind() == ClassKind.ENUM_CLASS || containingDeclaration.getKind() == ClassKind.ENUM_ENTRY) {
writeParameter(sw, JvmMethodParameterKind.ENUM_NAME, KotlinBuiltIns.getInstance().getStringType());
writeParameter(sw, JvmMethodParameterKind.ENUM_ORDINAL, KotlinBuiltIns.getInstance().getIntType());
}
if (closure == null) return;
for (DeclarationDescriptor variableDescriptor : closure.getCaptureVariables().keySet()) {
Type type;
if (variableDescriptor instanceof VariableDescriptor && !(variableDescriptor instanceof PropertyDescriptor)) {
Type sharedVarType = getSharedVarType(variableDescriptor);
if (sharedVarType == null) {
sharedVarType = mapType(((VariableDescriptor) variableDescriptor).getType());
}
type = sharedVarType;
}
else if (isLocalNamedFun(variableDescriptor)) {
type = asmTypeForAnonymousClass(bindingContext, (FunctionDescriptor) variableDescriptor);
}
else {
type = null;
}
if (type != null) {
writeParameter(sw, JvmMethodParameterKind.CAPTURED_LOCAL_VARIABLE, type);
}
}